package model;

import controller.QueenController;
import java.util.ArrayList;
import javax.swing.DefaultListModel;

/**
 * Modelo del tablero
 * @author Samuel Chávez, Axel Mayorga
 */
public class ChessboardModel {
    private ArrayList<QueenController> queenControllers;
    private ArrayList<Integer> queens;
    private DefaultListModel instructions;
    private int height;
    private int width;
    private int kQueen;
    private boolean fail;
    
    public ChessboardModel()
    {
        height = 0;
        width = 0;
        queens = new ArrayList<Integer>(); 
        instructions=new DefaultListModel();
        queenControllers = new ArrayList<QueenController>();
    }

    /**
     * @return the queens
     */
    public ArrayList<Integer> getQueens() {
        return queens;
    }

    /**
     * @param queens the queens to set
     */
    public void setQueens(ArrayList<Integer> queens) {
        this.queens = queens;
    }

    /**
     * @return the instructions
     */
    public DefaultListModel getInstructions() {
        return instructions;
    }

    /**
     * @param instructions the instructions to set
     */
    public void setInstructions(DefaultListModel instructions) {
        this.instructions = instructions;
    }

    /**
     * @return the height
     */
    public int getHeight() {
        return height;
    }

    /**
     * @param height the height to set
     */
    public void setHeight(int height) {
        this.height = height;
    }

    /**
     * @return the width
     */
    public int getWidth() {
        return width;
    }

    /**
     * @param width the width to set
     */
    public void setWidth(int width) {
        this.width = width;
    }

    /**
     * @return the kQueen
     */
    public int getkQueen() {
        return kQueen;
    }

    /**
     * @param kQueen the kQueen to set
     */
    public void setkQueen(int kQueen) {
        this.kQueen = kQueen;
    }
    
    /**
     * 
     * @param p 
     */
    public void addQueenAt(Integer p)
    {
       this.queens.add(p); 
    }
    
    /**
     * 
     * @param p 
     */
    public void removeQueen(Integer p)
    {
        this.queens.remove(p);
    }
    
    /**
     * 
     * @param s 
     */
    public void addInstructionAt(String s)
    {
        this.instructions.addElement(s);
    }
    
    @Override
    public String toString()
    {
        return getQueens().toString();
    }

    /**
     * @return the queenControllers
     */
    public ArrayList<QueenController> getQueenControllers() {
        return queenControllers;
    }

    /**
     * @param queenControllers the queenControllers to set
     */
    public void setQueenControllers(ArrayList<QueenController> queenControllers) {
        this.queenControllers = queenControllers;
    }

    /**
     * @return the fail
     */
    public boolean isFail() {
        return fail;
    }

    /**
     * @param fail the fail to set
     */
    public void setFail(boolean fail) {
        this.fail = fail;
    }
}
